package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.Gonggao;
import com.ruoyi.system.service.IGonggaoService;
import com.ruoyi.system.service.ISysUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 *
 * 
 * @author zxl
 * @date 2022-12-20
 */
@Controller
@RequestMapping("/system/gonggaoView")
public class GonggaoViewController extends BaseController
{

    private String prefix = "system/gonggaoView";
    @Autowired
    private IGonggaoService gonggaoService;

    @Autowired
    private ISysUserService sysUserService;


    //@RequiresPermissions("system:gonggao:list")
    @GetMapping()
    public String gonggaoView()
    {
        return prefix + "/gonggaoView";
    }


    //@RequiresPermissions("system:gonggao:list")
    @GetMapping("/detail")
    public String gonggaoViewDetail(@RequestParam("gonggaoid") String ppgonggaoid, ModelMap ppMap)
    {
        ppMap.put("gonggaoid",ppgonggaoid);
        return prefix + "/gonggaoViewDetail";
    }
    /**
     * 查询通知公告列表
     */
    //@RequiresPermissions("system:gonggao:list")
    @PostMapping("/list")
    @ResponseBody
    public List<Gonggao> gonggaoViewlist()
    {

        String userId = Long.toString(getUserId());
        List<Gonggao> list = gonggaoService.selectGonggaoViewList(userId);
        return list;
    }

    /**
     * 查询单个通知公告
     */
    //@RequiresPermissions("system:gonggao:list")
    @GetMapping("/detailone")
    @ResponseBody
    public Gonggao gonggaoViewDetailOne(@RequestParam("gonggaoid") String gonggaoid)
    {

        Gonggao gonggao = gonggaoService.selectGonggaoByGonggaoid(gonggaoid);
        return gonggao;
    }


}
